import java.util.ArrayList;
import java.util.List;
import java.util.Stack;

public class Test {
    public static void main(String[] args) {
        String s = "s";
        Stack<Character> stack = new Stack<>();
        System.out.println(s.equals("s"));
    }
}
class ListNode {
      int val;
      ListNode next;
      ListNode() {
      }
      ListNode(int val) {
          this.val = val;
      }
      ListNode(int val, ListNode next) {
          this.val = val;
          this.next = next;
      }
  }
    class Solution {
    private ListNode insert(ListNode l1, ListNode l2){
        ListNode cur = new ListNode();
        ListNode ret = cur;
        while(l1 != null && l2 != null){
            if(l1.val < l2.val){
                ret.next = l1;
                l1 = l1.next;
            }else{
                ret.next = l2;
                l2 = l2.next;
            }
            ret = ret.next;
        }
        if(l1 != null) ret.next = l1;
        if(l2 != null) ret.next = l2;
        return cur.next;
    }
    public ListNode mergeKLists(ListNode[] lists) {
        ListNode ans = null;
        for(int i=0; i<lists.length; i++){
            ans = insert(ans,lists[i]);
        }
        return ans;
    }
}
class Solution2 {
    List<String> ans = new ArrayList<>();
    StringBuilder s = new StringBuilder();
    char[] ch = {'(',')'};
    private void dfs(int n, int i, int j){
        if(i == n){
            for(int m=j; m<n; m++){
                s.append(')');
            }
            ans.add(s.toString());
            s.delete(n+j,s.length());
            return;
        }
        if(i == j){
            s.append('(');
            dfs(n,i+1,j);
            s.deleteCharAt(s.length()-1);
        }else if(i > j){
            s.append('(');
            dfs(n,i+1,j);
            s.deleteCharAt(s.length()-1);
            s.append(')');
            dfs(n,i,j+1);
            s.deleteCharAt(s.length()-1);
        }
    }
    public List<String> generateParenthesis(int n) {
        dfs(n,0,0);
        return ans;
    }
}
class Solution {
    public int longestValidParentheses(String s) {
        int l = 0, r = 0;
        int ans = 0;
        for(int i=0; i<s.length(); i++){
            if(s.charAt(i) == '('){
                l++;
            }else{
                r++;
            }
            if(l == r){
                ans = Math.max(ans, 2*r);
            }else if(l < r){
                l = r = 0;
            }
        }
        l = r = 0;
        for(int i=s.length()-1; i>=0; i--){
            if(s.charAt(i) == '('){
                l++;
            }else{
                r++;
            }
            if(l == r){
                ans = Math.max(ans, 2*l);
            }else if(l > r){
                l = r = 0;
            }
        }
        return ans;
    }
}